package com.lan.viewObject;

import java.util.HashMap;

/**
 * <p>
 *  系统统一返回
 * </p>
 *
 * @author shadow
 * @since 2022-09-24
 */
public class SysR extends HashMap<String, Object> {

    public static final String CODE   = "code";   //1正常、0失败
    public static final String STATUS = "status"; //200成功、RCodeEnums系统自定义错误状态码
    public static final String MSG    = "msg";
    public static final String DATA    = "data";
    public static final String LIST   = "list";
    public static final String PAGE   = "page";
    public static final String MAP    = "map";
    public static final String COUNT = "count";

    private static final String SUCCESS = "success";

    public SysR() {
        this.put(CODE, 1);
        this.put(STATUS, 200);
        this.put(MSG, SUCCESS);
    }

    public static SysR success() {
        return new SysR();
    }

    public static SysR success(final String msg) {
        SysR sysR = new SysR();
        sysR.put(MSG, msg);
        return sysR;
    }

}
